<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="layout">
<head>
<title th:text="${upsertText!}"></title>
</head>
<body>
	<div layout:fragment="content">
		<div class="row">
			<label th:text="${upsertText!}"></label>
		</div>
		<form class="form-horizontal" 
				th:action="${r'${'}${idName}} ? @{/${mappingVal}(update)} : @{/${mappingVal}(add)}" 
				th:object="${r'${model}'}" method="post">
				
			<input type="hidden" name="${idName}" th:value="${r'${'}${idName}}">
			
			<#list pageProps as pro>  
			<div class="form-group" th:class="${r'${'}#fields.hasErrors('${pro.name}')} ? 'form-group has-error' :'form-group'" >
				<label class="col-sm-2 control-label">${pro.comment!}</label>
				<div class="col-sm-5 ">
					<!-- 目前仅支持text,以后可以增加select,radio,checkbox,textarea -->
					<input type="text" name="${pro.name}" th:field="*{${pro.name}}" class="form-control">
				</div>
				<label class="col-sm-2 control-label"  th:errors="*{${pro.name}}"></label>
			</div>
			</#list> 
			
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-default">保 存</button>
				</div>
			</div>
			
		</form>
	</div>
</body>
</html>
